import commands

commands.getstatusoutput("rm svn_log*.tex svn_log_temp")
commands.getstatusoutput("svn log .. >> svn_log_temp")

head = False
skip = False
log = False
fout = file("svn_log.tex","write")

fout.write("\\begin{verbatim}\n")

with open("svn_log_temp") as f:
    for line in f:
        if head : 
#            print line[:-10]
            fout.write( line[:-10] + "\n")
            head = False
            skip = True
            continue
        if skip:
            skip = False
            log = True
            continue
        if (line.find("-------") != -1):
            log = False
            head = True
        if log:
#            print "    " + line[:-1]
            if len(line) > 85:
                cutline = line[:-1]
                fout.write("    " + cutline[:85] + "\n")
                fout.write("    " + cutline[85:] + "\n")
            else:
                fout.write("    " + line[:-1] + "\n")

fout.write("\\end{verbatim}\n")
commands.getstatusoutput("rm svn_log_temp")
fout.close()






